package etnorservice.etnor_service.mapper.projectMapper;


import etnorservice.etnor_service.domain.ProjectCategory;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProjectCategoryMapper {
    @Insert("INSERT INTO project_categories(name, description, display_order, created_at) " +
            "VALUES(#{name}, #{description}, #{displayOrder}, NOW())")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(ProjectCategory category);

    @Select("SELECT * FROM project_categories ORDER BY display_order")
    List<ProjectCategory> findAll();

    @Select("SELECT * FROM project_categories WHERE id = #{id}")
    ProjectCategory findById(Long id);
}
